package com.example.fengyungo.dao;

import com.example.fengyungo.domain.pojo.Thing;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ThingDao {

    /**
     * 根据货物编号查找货物
     * @param number 货物编号
     * @return 货物信息Thing
     */
    @Select("select * from thing where number = #{number}")
    Thing getThingByNumber(String number);

    /**
     * 添加货物
     * @param thing 货物信息
     * @return Integer
     */
    @Insert("insert into thing " +
            "(number, length, width, height, weight, image) " +
            "VALUES " +
            "(#{number}, #{length}, #{width}, #{height}, #{weight}, #{image})")
    Integer addThing(Thing thing);
}
